<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>短网址服务---缩短、分享及监测你的链接</title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->webroot.'/theme/default/u22';?>/css/style.css"/>
<script type="text/javascript" src="<?php echo $this->webroot.'/misc/js';?>/jquery-1.5.min.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot.'/theme/default/u22';?>/js/home.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot.'/misc/pluges';?>/jquery-autocomplete/jquery.autocomplete.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->webroot.'/misc/pluges';?>/jquery-autocomplete/jquery.autocomplete.css" />
</head>
<style>
    #list_url{
        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;/*以省略号替代截除部分*/
}
</style>
<script type="text/javascript">
    var post    = true;
    var login   = '<?php echo $_SESSION['user']['id']?>';
    var bin     = '<?php echo url_for("bin");?>';
    var servlet = '<?php echo url_for('servlet');?>';
    var api = '<?php echo url_for('api');?>';
    var front = '<?php echo url_for('front');?>';
    $(document).ready(function() {
        $("#email").autocomplete(
        bin+"/join_us.php",
        {
            delay:10,
            minChars:1,
            matchSubset:1,
            matchContains:1,
            cacheLength:10,
            autoFill:false
        }
        ).result(function(){
             var search_str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
             var email_val = $("#email").val();
             if(search_str.test(email_val)){
                checkEmail();
             }else{
                 $("#email").val('email格式错误.');
             }
        });

        $("#login_email").autocomplete(
        bin+"/join_us.php",
        {
            delay:10,
            minChars:1,
            matchSubset:1,
            matchContains:1,
            cacheLength:10,
            autoFill:false
        });
        get_url_list();
    });
    
    function short_url(){
        var short_url = $("#short_url").val();
        $.ajax({
            url:servlet+"/add_url",
            dataType:"json",
            type:"POST",
            data:{'url':short_url},
            success:function(data){
                if(data.code =='error'){
                    alert(data.msg);
                }else if(data.code =='ok'){
                    get_url_list();
                    alert(1111);
                    hideAjax();
                }else{
                    alert(data);
                }
            },error:function(){
                alert('连接超时');
            },beforeSend:function(){
                showAjax();
            }
        });
    }
    
    function short_url_api(){
        var short_url = $("#short_url").val();
        $.ajax({
            url:servlet+"/tencent_url_add",
            dataType:"html",
            type:"POST",
            data:{'url':short_url},
            success:function(data){
                if(data.code ==''){
                    alert('添加失败');
                }else if(data != ''){
                    get_url_list();
                }else{
                    alert(data);
                }
            },error:function(){
                alert('请稍后再试');
            },beforeSend:function(){
                //alert('加载中');
            }
        });
    }

    function get_url_list(){
        $.ajax({
            url:servlet+"/guest_url_list",
            dataType:"html",
            type:"get",
            success:function(data){
                $("#list_url").html(data);
            }
        });
    }

    function showHideTr(id){
        $('.hidden').hide();
        var act = $("#act_2_"+id);
        act.toggle();
    }

    function loged(){
        location.href ='/user';
    }
</script>
<script type="text/javascript" src="<?php echo $this->webroot.'/theme/default/u22/js/';?>home.js"></script>
<body>
<div class="warp">
	<div class="main">
    	<div class="logo"><img src="<?php echo $this->webroot.'/theme/default/u22/images';?>/logo.jpg" /></div>
        <p>缩短、分享及监测你的链接</p>
        <div class="content" id="list" >
            <div class="area">
                <input name="" type="text" class="text_are" id="short_url"/><input name="" type="button" class="text_btn" value="立即缩短" onclick="short_url();"/>
                <a href="javascript:showDiv()"><img src="<?php echo $this->webroot.'/theme/default/u22/images';?>/login.png" /></a>
                <div class="c"></div>
            </div>
            <div class="list" style="width: 600px;">
                    <table width="600" border="0" cellpadding="0" cellspacing="0" id="list_url">

                    </table>
          </div>
            <div class="signdes">

                <img src="<?php echo $this->webroot.'/theme/default/u22/images';?>/des_sign.png" border="0" usemap="#Map" />
                <map name="Map" id="Map">
                  <area shape="rect" coords="430,12,531,45" href="javascript:showMe();" />
                </map>
            </div>
            <div class="weibo">
        	<a href="<?php echo url_for('cgi/sina')?>"><img src="<?php echo $this->webroot.'/theme/default/u22/images';?>/btn_sina.gif" /></a>
            <a href="<?php echo url_for('cgi/tencent')?>"><img src="<?php echo $this->webroot.'/theme/default/u22/images';?>/btn_qq.gif" /></a>
        	</div>

        </div>
        <div class="signin show" id="sign">
        	<h3><span class="l">新用户注册</span><span class="r"><a href="#" onclick="closeMe()"><img src="<?php echo $this->webroot.'/theme/default/u22/images';?>/btn_close.gif" /></a></span><div class="c"></div></h3>
            <div class="signmes">
            	<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="right">邮箱：</td>
                    <td colspan="2"><label>

                      <input name="textfield" type="text" class="signtext" id="email" />
                        </label><img id="img_ok" src="<?php echo $this->webroot.'/theme/default/u22/images';?>/ok.gif" style="display: none;"/>
                        <img id="error_img" src="<?php echo $this->webroot.'/theme/default/u22/images';?>/error.gif" style="display: none;"/>
                        <span id="error"></span>
                    </td>
                  </tr>
                  <tr>
                    <td align="right">密码：</td>
                    <td colspan="2"><input name="textfield2" type="password" class="signtext" id="password1" onblur='$("#pass1_ok").show();'/>
                        <img id="pass1_ok" style="display: none;" src="<?php echo $this->webroot.'/theme/default/u22/images';?>/ok.gif" />
                        <img id="pass1_error" style="display: none;" src="<?php echo $this->webroot.'/theme/default/u22/images';?>/error.gif" />
                    </td>
                  </tr>

                  <tr>
                    <td align="right">确认密码：</td>
                    <td colspan="2"><input name="textfield3" type="password" class="signtext" id="password2" onblur="check_pass();"/>
                        <img id="pass2_ok" style="display: none;" src="<?php echo $this->webroot.'/theme/default/u22/images';?>/ok.gif" />
                        <img id="pass2_error" style="display: none;" src="<?php echo $this->webroot.'/theme/default/u22/images';?>/error.gif" />
                    </td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td colspan="2"><label><input name="checkbox" type="checkbox" id="checkbox" checked="checked" />
                    我已阅读并同意《<a href="#">u22用户服务协议</a>》</label></td>

                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td><span class="btn_in"><a href="javascript:join_us();"><img src="<?php echo $this->webroot.'/theme/default/u22/images';?>/btn_signin.png"/></a></span>
                        </td>
                  </tr>
                </table>
          </div>

          <div class="sign_t">
              <a href="<?php echo url_for('cgi/sina')?>"><img src="<?php echo $this->webroot.'/theme/default/u22/images';?>/btn_sina.gif" /></a>
          	<a href="<?php echo url_for('cgi/tencet')?>"><img src="<?php echo $this->webroot.'/theme/default/u22/images';?>/btn_qq.gif" /></a>
          </div>
      </div>
</div>
    <div class="footer">© 2011 U22.CC</div>
</div>
<div id="bg" class="bg" style="display:none;"></div>

<div class="login_wrap show" id="popDiv">
    <h3><span class="l">用户登录</span><span class="r"><a href="javascript:closeDiv()"><img src="<?php echo $this->webroot . '/theme/default/u22/images'; ?>/btn_close.gif" /></a></span><div class="c"></div></h3>
    <div class="signmes">
        <table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td align="right">邮箱：</td>
                <td colspan="2"><label>
                        <input name="textfield" type="text" class="signtext" id="login_email" />
                    </label></td>

            </tr>
            <tr>
                <td align="right">密码：</td>
                <td colspan="2"><input name="textfield2" type="password" class="signtext" id="login_password" /></td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td colspan="2"><label>
                        <a href="#">？忘记密码</a></label></td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td><span class="btn_in"><a href="javascript:login_in();"><img src="<?php echo $this->webroot . '/theme/default/u22/images'; ?>/btn_login.png"/></a></span>
                </td>
            </tr>

        </table>
    </div>
    <div class="sign_t">
        <a href="<?php echo url_for('cgi/sina')?>"><img src="<?php echo $this->webroot . '/theme/default/u22/images'; ?>/btn_sina.gif" /></a>
        <a href="<?php echo url_for('cgi/tencent')?>"><img src="<?php echo $this->webroot . '/theme/default/u22/images'; ?>/btn_qq.gif" /></a>
    </div>
</div>

<!--弹出层-->
<div class="login_wrap show" id="show_notice">
    <h3><span class="l">网址缩短</span><span class="r"></span><div class="c"></div></h3>
    <div class="signmes">
        <table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td align="right"></td>
                <td colspan="2"><label>
                        正在缩短中，请稍后...<br/>
                        若长时间没反应，请刷新
                    </label></td>

            </tr>
        </table>
    </div>
</div>

</body>
</html>
